/**
 * Created by yj on 2017/6/28.
 */
let weeks =function(dates){
  var week = ["周日","周一","周二","周三","周四","周五","周六"];
  var getduy = dates.replace(/-/g,",");
  var today = '今天',
      tomorrow = '明天',
      nextTomorrow = '后天';

  var curdate = new Date(),
      y = curdate.getFullYear(),
      m = curdate.getMonth() + 1,
      currentDate,
      d;
  m = m < 10 ? '0' + m : m;
  d = curdate.getDate();
  d = d < 10 ? ('0' + d) : d;
  currentDate =  y + '-' + m + '-' + d;

  var date = new Date(getduy),
      curTime = (new Date(currentDate)).getTime(),
      datesTime = (new Date(dates)).getTime();
  if(curTime == datesTime) {
    return today
  } else if(datesTime <= curTime + 86400000) {
    return tomorrow
  }else if(datesTime <= curTime + 86400000 + 86400000) {
    return  nextTomorrow
  } else {
    return week[date.getDay()]
  }
}
export{weeks}
